﻿{
	"ProcessTemplates": [
		{
			"Name": "AI-Generated Patient Summary",
			"Modified": "2025-02-27T20:40:36.3329538",
			"Modifier": "michal.nowakowski@frends.com",
			"Tags": [
				"ChatGPT"
			],
			"TemplateProcessTags": [
				"ChatGPT"
			],
			"Description": "This template retrieves a patient’s history from the database, anonymizes the data, generates an AI summary for the doctor, and saves it in the database.",
			"Version": 1,
			"UniqueIdentifier": "c06b2726-79a7-4d6e-a6c0-2bc013288558",
			"ProcessVariablesJson": "{\"ConnectionString\":{\"Value\":\"\\\"cs\\\"\",\"IsSecret\":true,\"Mode\":\"text\",\"Description\":\"Connection string for the database.\"},\"ChatGptApiKey\":{\"Value\":\"\\\"apikey\\\"\",\"IsSecret\":true,\"Mode\":\"text\",\"Description\":\"API key for Chat GPT.\"}}",
			"ProcessInfo": {
				"Process": {
					"Name": "AI-Generated Patient Summary",
					"Modified": "2025-02-27T20:40:36.3329538",
					"Modifier": "michal.nowakowski@frends.com",
					"TagString": null,
					"Tags": [],
					"Description": "This template retrieves a patient’s history from the database, anonymizes the data, generates an AI summary for the doctor, and saves it in the database.",
					"Version": 1,
					"UniqueIdentifier": "ee0ebe66-565e-4efa-8dc9-c64b4f4f8377",
					"GraphJson": null,
					"Bpmn": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<bpmn2:definitions xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:bpmn2=\"http://www.omg.org/spec/BPMN/20100524/MODEL\" xmlns:bpmndi=\"http://www.omg.org/spec/BPMN/20100524/DI\" xmlns:dc=\"http://www.omg.org/spec/DD/20100524/DC\" xmlns:di=\"http://www.omg.org/spec/DD/20100524/DI\" id=\"sample-diagram\" targetNamespace=\"http://bpmn.io/schema/bpmn\" xsi:schemaLocation=\"http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd\"><bpmn2:process id=\"Process_1\" isExecutable=\"false\"><bpmn2:startEvent id=\"StartEvent_1\" name=\"Manual\"><bpmn2:outgoing>Flow_1v91on0</bpmn2:outgoing></bpmn2:startEvent><bpmn2:task id=\"Activity_0h4alnp\" name=\"Get appointment data\"><bpmn2:incoming>Flow_1v91on0</bpmn2:incoming><bpmn2:outgoing>Flow_0lgg7fz</bpmn2:outgoing><bpmn2:property id=\"Property_1qkx1g5\" name=\"__targetRef_placeholder\" /><bpmn2:dataInputAssociation id=\"DataInputAssociation_0cml31b\"><bpmn2:sourceRef>DataStoreReference_0m8x34o</bpmn2:sourceRef><bpmn2:targetRef>Property_1qkx1g5</bpmn2:targetRef></bpmn2:dataInputAssociation></bpmn2:task><bpmn2:sequenceFlow id=\"Flow_1v91on0\" sourceRef=\"StartEvent_1\" targetRef=\"Activity_0h4alnp\" /><bpmn2:task id=\"Activity_0z4c9j6\" name=\"Get patient history\"><bpmn2:incoming>Flow_0lgg7fz</bpmn2:incoming><bpmn2:outgoing>Flow_0y0bwn5</bpmn2:outgoing><bpmn2:property id=\"Property_16xnydm\" name=\"__targetRef_placeholder\" /><bpmn2:dataInputAssociation id=\"DataInputAssociation_0gmah6v\"><bpmn2:sourceRef>DataStoreReference_16cg3r7</bpmn2:sourceRef><bpmn2:targetRef>Property_16xnydm</bpmn2:targetRef></bpmn2:dataInputAssociation></bpmn2:task><bpmn2:sequenceFlow id=\"Flow_0lgg7fz\" sourceRef=\"Activity_0h4alnp\" targetRef=\"Activity_0z4c9j6\" /><bpmn2:task id=\"Activity_0z68v6e\" name=\"Summarize with AI\"><bpmn2:incoming>Flow_1qodmln</bpmn2:incoming><bpmn2:incoming>Flow_1k6ogzn</bpmn2:incoming><bpmn2:outgoing>Flow_0279l5h</bpmn2:outgoing></bpmn2:task><bpmn2:task id=\"Activity_1nsommj\" name=\"Ask AI is lab test needed\"><bpmn2:incoming>Flow_1ih1mwl</bpmn2:incoming><bpmn2:outgoing>Flow_1v4s3v8</bpmn2:outgoing></bpmn2:task><bpmn2:sequenceFlow id=\"Flow_0y0bwn5\" sourceRef=\"Activity_0z4c9j6\" targetRef=\"Activity_02k0hfr\" /><bpmn2:scriptTask id=\"Activity_02k0hfr\" name=\"Anonymize data\"><bpmn2:incoming>Flow_0y0bwn5</bpmn2:incoming><bpmn2:outgoing>Flow_1ih1mwl</bpmn2:outgoing></bpmn2:scriptTask><bpmn2:sequenceFlow id=\"Flow_1ih1mwl\" sourceRef=\"Activity_02k0hfr\" targetRef=\"Activity_1nsommj\" /><bpmn2:sequenceFlow id=\"Flow_1v4s3v8\" sourceRef=\"Activity_1nsommj\" targetRef=\"Activity_1pn18so\" /><bpmn2:task id=\"Activity_18f8m89\" name=\"Update appoitment data with AI summary\"><bpmn2:incoming>Flow_0279l5h</bpmn2:incoming><bpmn2:outgoing>Flow_06a3aft</bpmn2:outgoing><bpmn2:dataOutputAssociation id=\"DataOutputAssociation_0eiqn7m\"><bpmn2:targetRef>DataStoreReference_08whtpi</bpmn2:targetRef></bpmn2:dataOutputAssociation></bpmn2:task><bpmn2:sequenceFlow id=\"Flow_0279l5h\" sourceRef=\"Activity_0z68v6e\" targetRef=\"Activity_18f8m89\" /><bpmn2:exclusiveGateway id=\"Gateway_1t3wrju\" name=\"Is laboratory results needed?\" default=\"Flow_1k6ogzn\"><bpmn2:incoming>Flow_13lrnry</bpmn2:incoming><bpmn2:outgoing>Flow_1jpm47u</bpmn2:outgoing><bpmn2:outgoing>Flow_1k6ogzn</bpmn2:outgoing></bpmn2:exclusiveGateway><bpmn2:sequenceFlow id=\"Flow_1jpm47u\" name=\"yes\" sourceRef=\"Gateway_1t3wrju\" targetRef=\"Activity_0y5ijz0\" /><bpmn2:task id=\"Activity_0y5ijz0\" name=\"Get patient laboratory results\"><bpmn2:incoming>Flow_1jpm47u</bpmn2:incoming><bpmn2:outgoing>Flow_1u0zdxl</bpmn2:outgoing><bpmn2:property id=\"Property_1ynegtu\" name=\"__targetRef_placeholder\" /><bpmn2:dataInputAssociation id=\"DataInputAssociation_00l6js4\"><bpmn2:sourceRef>DataStoreReference_0yjwqa9</bpmn2:sourceRef><bpmn2:targetRef>Property_1ynegtu</bpmn2:targetRef></bpmn2:dataInputAssociation></bpmn2:task><bpmn2:scriptTask id=\"Activity_1pn18so\" name=\"Assign lab_results\"><bpmn2:incoming>Flow_1v4s3v8</bpmn2:incoming><bpmn2:outgoing>Flow_13lrnry</bpmn2:outgoing></bpmn2:scriptTask><bpmn2:sequenceFlow id=\"Flow_13lrnry\" sourceRef=\"Activity_1pn18so\" targetRef=\"Gateway_1t3wrju\" /><bpmn2:scriptTask id=\"Activity_0kcukgt\" name=\"Update lab_results\"><bpmn2:incoming>Flow_1u0zdxl</bpmn2:incoming><bpmn2:outgoing>Flow_1qodmln</bpmn2:outgoing></bpmn2:scriptTask><bpmn2:endEvent id=\"Event_0dogmvt\"><bpmn2:incoming>Flow_06a3aft</bpmn2:incoming></bpmn2:endEvent><bpmn2:sequenceFlow id=\"Flow_06a3aft\" sourceRef=\"Activity_18f8m89\" targetRef=\"Event_0dogmvt\" /><bpmn2:dataStoreReference id=\"DataStoreReference_0m8x34o\" name=\"Database\" /><bpmn2:dataStoreReference id=\"DataStoreReference_16cg3r7\" name=\"Database\" /><bpmn2:dataStoreReference id=\"DataStoreReference_0yjwqa9\" name=\"Database\" /><bpmn2:dataStoreReference id=\"DataStoreReference_08whtpi\" name=\"Database\" /><bpmn2:sequenceFlow id=\"Flow_1u0zdxl\" sourceRef=\"Activity_0y5ijz0\" targetRef=\"Activity_0kcukgt\" /><bpmn2:sequenceFlow id=\"Flow_1qodmln\" sourceRef=\"Activity_0kcukgt\" targetRef=\"Activity_0z68v6e\" /><bpmn2:sequenceFlow id=\"Flow_1k6ogzn\" name=\"no\" sourceRef=\"Gateway_1t3wrju\" targetRef=\"Activity_0z68v6e\" /><bpmn2:group id=\"Group_1owuz4v\" categoryValueRef=\"CategoryValue_092c91j\" /><bpmn2:group id=\"Group_0jbxajt\" categoryValueRef=\"CategoryValue_0pqnmjg\" /><bpmn2:group id=\"Group_1clyclr\" categoryValueRef=\"CategoryValue_1gw5atx\" /><bpmn2:group id=\"Group_1cnpzbz\" categoryValueRef=\"CategoryValue_1ugr7l2\" /><bpmn2:textAnnotation id=\"TextAnnotation_06pguus\"><bpmn2:text>The anonymization function processes a JSON to remove sensitive information related to personal identifiers.</bpmn2:text></bpmn2:textAnnotation><bpmn2:association id=\"Association_10s1yai\" sourceRef=\"Activity_02k0hfr\" targetRef=\"TextAnnotation_06pguus\" /><bpmn2:textAnnotation id=\"TextAnnotation_1k4djxh\"><bpmn2:text>This prompt asks the AI if laboratory results are needed based on the appointment reason and medical history to prepare a summary.</bpmn2:text></bpmn2:textAnnotation><bpmn2:association id=\"Association_0p8zq8n\" sourceRef=\"Activity_1nsommj\" targetRef=\"TextAnnotation_1k4djxh\" /><bpmn2:textAnnotation id=\"TextAnnotation_16vjdon\"><bpmn2:text>This prompt instructs the AI to generate a brief summary, up to 5 questions for the patient, and a recommended course of action based on the provided appointment reason and medical history.</bpmn2:text></bpmn2:textAnnotation><bpmn2:association id=\"Association_11zpa6h\" sourceRef=\"Activity_0z68v6e\" targetRef=\"TextAnnotation_16vjdon\" /><bpmn2:textAnnotation id=\"TextAnnotation_1p3bi9e\"><bpmn2:text>This trigger passes the appointment ID to retrieve data for the next steps.</bpmn2:text></bpmn2:textAnnotation><bpmn2:association id=\"Association_1ybki6e\" sourceRef=\"StartEvent_1\" targetRef=\"TextAnnotation_1p3bi9e\" /><bpmn2:textAnnotation id=\"TextAnnotation_05u59m9\"><bpmn2:text>Return Summary generated by AI</bpmn2:text></bpmn2:textAnnotation><bpmn2:association id=\"Association_04x6h6h\" sourceRef=\"Event_0dogmvt\" targetRef=\"TextAnnotation_05u59m9\" /><bpmn2:textAnnotation id=\"TextAnnotation_19wwn0j\"><bpmn2:text>Retrieves patient history including some personal data.</bpmn2:text></bpmn2:textAnnotation><bpmn2:association id=\"Association_0u1ta5n\" sourceRef=\"Activity_0z4c9j6\" targetRef=\"TextAnnotation_19wwn0j\" /></bpmn2:process><bpmn2:category id=\"Category_1ut6d3x\"><bpmn2:categoryValue id=\"CategoryValue_092c91j\" value=\"Retrieves the patient&#39;s data using the given appoitment ID\" /></bpmn2:category><bpmn2:category id=\"Category_05or4i0\"><bpmn2:categoryValue id=\"CategoryValue_0pqnmjg\" value=\"Data anonymization\" /></bpmn2:category><bpmn2:category id=\"Category_1gu96fj\"><bpmn2:categoryValue id=\"CategoryValue_1gw5atx\" value=\"Retrieves additional data if needed\" /></bpmn2:category><bpmn2:category id=\"Category_0ndgsf2\"><bpmn2:categoryValue id=\"CategoryValue_1ugr7l2\" value=\"Create AI Summary and update database\" /></bpmn2:category><bpmndi:BPMNDiagram id=\"BPMNDiagram_1\"><bpmndi:BPMNPlane id=\"BPMNPlane_1\" bpmnElement=\"Process_1\"><bpmndi:BPMNShape id=\"TextAnnotation_05u59m9_di\" bpmnElement=\"TextAnnotation_05u59m9\"><dc:Bounds x=\"1931\" y=\"151\" width=\"110\" height=\"38\" /><bpmndi:BPMNLabel /></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"_BPMNShape_StartEvent_2\" bpmnElement=\"StartEvent_1\"><dc:Bounds x=\"372\" y=\"240\" width=\"36\" height=\"36\" /><bpmndi:BPMNLabel><dc:Bounds x=\"372\" y=\"276\" width=\"37\" height=\"14\" /></bpmndi:BPMNLabel></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"Activity_0h4alnp_di\" bpmnElement=\"Activity_0h4alnp\"><dc:Bounds x=\"490\" y=\"218\" width=\"100\" height=\"80\" /><bpmndi:BPMNLabel /></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"BPMNShape_1tj7z3z\" bpmnElement=\"Activity_0z4c9j6\"><dc:Bounds x=\"650\" y=\"218\" width=\"100\" height=\"80\" /><bpmndi:BPMNLabel /></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"Activity_0z68v6e_di\" bpmnElement=\"Activity_0z68v6e\"><dc:Bounds x=\"1660\" y=\"218\" width=\"100\" height=\"80\" /><bpmndi:BPMNLabel /></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"BPMNShape_0l9q7al\" bpmnElement=\"Activity_1nsommj\"><dc:Bounds x=\"1000\" y=\"218\" width=\"100\" height=\"80\" /><bpmndi:BPMNLabel /></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"Activity_02k0hfr_di\" bpmnElement=\"Activity_02k0hfr\"><dc:Bounds x=\"820\" y=\"218\" width=\"100\" height=\"80\" /><bpmndi:BPMNLabel /></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"BPMNShape_0m24hjk\" bpmnElement=\"Activity_18f8m89\"><dc:Bounds x=\"1790\" y=\"218\" width=\"100\" height=\"80\" /><bpmndi:BPMNLabel /></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"Gateway_1t3wrju_di\" bpmnElement=\"Gateway_1t3wrju\" isMarkerVisible=\"true\"><dc:Bounds x=\"1255\" y=\"233\" width=\"50\" height=\"50\" /><bpmndi:BPMNLabel><dc:Bounds x=\"1243\" y=\"290\" width=\"79\" height=\"27\" /></bpmndi:BPMNLabel></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"BPMNShape_0qjsumw\" bpmnElement=\"Activity_0y5ijz0\"><dc:Bounds x=\"1380\" y=\"218\" width=\"100\" height=\"80\" /><bpmndi:BPMNLabel /></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"Activity_1pn18so_di\" bpmnElement=\"Activity_1pn18so\"><dc:Bounds x=\"1145\" y=\"243\" width=\"30\" height=\"30\" /><bpmndi:BPMNLabel /></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"BPMNShape_0rk9agf\" bpmnElement=\"Activity_0kcukgt\"><dc:Bounds x=\"1525\" y=\"243\" width=\"30\" height=\"30\" /><bpmndi:BPMNLabel /></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"Event_0dogmvt_di\" bpmnElement=\"Event_0dogmvt\"><dc:Bounds x=\"1962\" y=\"240\" width=\"36\" height=\"36\" /></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"DataStoreReference_0m8x34o_di\" bpmnElement=\"DataStoreReference_0m8x34o\"><dc:Bounds x=\"515\" y=\"125\" width=\"50\" height=\"50\" /><bpmndi:BPMNLabel><dc:Bounds x=\"516\" y=\"101\" width=\"48\" height=\"14\" /></bpmndi:BPMNLabel></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"BPMNShape_022y0nt\" bpmnElement=\"DataStoreReference_16cg3r7\"><dc:Bounds x=\"675\" y=\"125\" width=\"50\" height=\"50\" /><bpmndi:BPMNLabel><dc:Bounds x=\"676\" y=\"101\" width=\"48\" height=\"14\" /></bpmndi:BPMNLabel></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"BPMNShape_17g3xxw\" bpmnElement=\"DataStoreReference_0yjwqa9\"><dc:Bounds x=\"1405\" y=\"325\" width=\"50\" height=\"50\" /><bpmndi:BPMNLabel><dc:Bounds x=\"1406\" y=\"385\" width=\"48\" height=\"14\" /></bpmndi:BPMNLabel></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"BPMNShape_1j1w0bi\" bpmnElement=\"DataStoreReference_08whtpi\"><dc:Bounds x=\"1815\" y=\"125\" width=\"50\" height=\"50\" /><bpmndi:BPMNLabel><dc:Bounds x=\"1817\" y=\"101\" width=\"48\" height=\"14\" /></bpmndi:BPMNLabel></bpmndi:BPMNShape><bpmndi:BPMNEdge id=\"Association_04x6h6h_di\" bpmnElement=\"Association_04x6h6h\"><di:waypoint x=\"1981\" y=\"240\" /><di:waypoint x=\"1981\" y=\"189\" /></bpmndi:BPMNEdge><bpmndi:BPMNShape id=\"Group_1owuz4v_di\" bpmnElement=\"Group_1owuz4v\"><dc:Bounds x=\"460\" y=\"-70\" width=\"310\" height=\"480\" /><bpmndi:BPMNLabel><dc:Bounds x=\"579\" y=\"-63\" width=\"74\" height=\"53\" /></bpmndi:BPMNLabel></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"Group_0jbxajt_di\" bpmnElement=\"Group_0jbxajt\"><dc:Bounds x=\"790\" y=\"-70\" width=\"160\" height=\"480\" /><bpmndi:BPMNLabel><dc:Bounds x=\"835\" y=\"-63\" width=\"71\" height=\"27\" /></bpmndi:BPMNLabel></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"Group_1clyclr_di\" bpmnElement=\"Group_1clyclr\"><dc:Bounds x=\"970\" y=\"-70\" width=\"620\" height=\"480\" /><bpmndi:BPMNLabel><dc:Bounds x=\"1239\" y=\"-63\" width=\"82\" height=\"40\" /></bpmndi:BPMNLabel></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"Group_1cnpzbz_di\" bpmnElement=\"Group_1cnpzbz\"><dc:Bounds x=\"1610\" y=\"-70\" width=\"300\" height=\"480\" /><bpmndi:BPMNLabel><dc:Bounds x=\"1719\" y=\"-63\" width=\"82\" height=\"40\" /></bpmndi:BPMNLabel></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"TextAnnotation_06pguus_di\" bpmnElement=\"TextAnnotation_06pguus\"><dc:Bounds x=\"820\" y=\"70\" width=\"120\" height=\"100\" /><bpmndi:BPMNLabel /></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"TextAnnotation_1k4djxh_di\" bpmnElement=\"TextAnnotation_1k4djxh\"><dc:Bounds x=\"1000\" y=\"60\" width=\"130\" height=\"110\" /><bpmndi:BPMNLabel /></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"TextAnnotation_16vjdon_di\" bpmnElement=\"TextAnnotation_16vjdon\"><dc:Bounds x=\"1640\" y=\"0\" width=\"150\" height=\"150\" /><bpmndi:BPMNLabel /></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"TextAnnotation_1p3bi9e_di\" bpmnElement=\"TextAnnotation_1p3bi9e\"><dc:Bounds x=\"340\" y=\"101\" width=\"100\" height=\"98\" /><bpmndi:BPMNLabel /></bpmndi:BPMNShape><bpmndi:BPMNShape id=\"TextAnnotation_19wwn0j_di\" bpmnElement=\"TextAnnotation_19wwn0j\"><dc:Bounds x=\"650\" y=\"320\" width=\"100\" height=\"70\" /><bpmndi:BPMNLabel /></bpmndi:BPMNShape><bpmndi:BPMNEdge id=\"DataInputAssociation_0cml31b_di\" bpmnElement=\"DataInputAssociation_0cml31b\"><di:waypoint x=\"540\" y=\"175\" /><di:waypoint x=\"540\" y=\"218\" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"Flow_1v91on0_di\" bpmnElement=\"Flow_1v91on0\"><di:waypoint x=\"408\" y=\"258\" /><di:waypoint x=\"490\" y=\"258\" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"DataInputAssociation_0gmah6v_di\" bpmnElement=\"DataInputAssociation_0gmah6v\"><di:waypoint x=\"700\" y=\"175\" /><di:waypoint x=\"700\" y=\"218\" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"Flow_0lgg7fz_di\" bpmnElement=\"Flow_0lgg7fz\"><di:waypoint x=\"590\" y=\"258\" /><di:waypoint x=\"650\" y=\"258\" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"Flow_0y0bwn5_di\" bpmnElement=\"Flow_0y0bwn5\"><di:waypoint x=\"750\" y=\"258\" /><di:waypoint x=\"820\" y=\"258\" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"Flow_1ih1mwl_di\" bpmnElement=\"Flow_1ih1mwl\"><di:waypoint x=\"920\" y=\"258\" /><di:waypoint x=\"1000\" y=\"258\" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"Flow_1v4s3v8_di\" bpmnElement=\"Flow_1v4s3v8\"><di:waypoint x=\"1100\" y=\"258\" /><di:waypoint x=\"1145\" y=\"258\" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"DataOutputAssociation_0eiqn7m_di\" bpmnElement=\"DataOutputAssociation_0eiqn7m\"><di:waypoint x=\"1840\" y=\"218\" /><di:waypoint x=\"1840\" y=\"175\" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"Flow_0279l5h_di\" bpmnElement=\"Flow_0279l5h\"><di:waypoint x=\"1760\" y=\"258\" /><di:waypoint x=\"1790\" y=\"258\" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"Flow_1jpm47u_di\" bpmnElement=\"Flow_1jpm47u\"><di:waypoint x=\"1305\" y=\"258\" /><di:waypoint x=\"1380\" y=\"258\" /><bpmndi:BPMNLabel><dc:Bounds x=\"1332\" y=\"240\" width=\"17\" height=\"14\" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"DataInputAssociation_00l6js4_di\" bpmnElement=\"DataInputAssociation_00l6js4\"><di:waypoint x=\"1430\" y=\"325\" /><di:waypoint x=\"1430\" y=\"298\" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"Flow_13lrnry_di\" bpmnElement=\"Flow_13lrnry\"><di:waypoint x=\"1175\" y=\"258\" /><di:waypoint x=\"1255\" y=\"258\" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"Flow_06a3aft_di\" bpmnElement=\"Flow_06a3aft\"><di:waypoint x=\"1890\" y=\"258\" /><di:waypoint x=\"1962\" y=\"258\" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"Flow_1u0zdxl_di\" bpmnElement=\"Flow_1u0zdxl\"><di:waypoint x=\"1480\" y=\"258\" /><di:waypoint x=\"1525\" y=\"258\" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"Flow_1qodmln_di\" bpmnElement=\"Flow_1qodmln\"><di:waypoint x=\"1555\" y=\"258\" /><di:waypoint x=\"1660\" y=\"258\" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"Flow_1k6ogzn_di\" bpmnElement=\"Flow_1k6ogzn\"><di:waypoint x=\"1280\" y=\"233\" /><di:waypoint x=\"1280\" y=\"180\" /><di:waypoint x=\"1690\" y=\"180\" /><di:waypoint x=\"1690\" y=\"218\" /><bpmndi:BPMNLabel><dc:Bounds x=\"1293\" y=\"202\" width=\"13\" height=\"14\" /></bpmndi:BPMNLabel></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"Association_10s1yai_di\" bpmnElement=\"Association_10s1yai\"><di:waypoint x=\"870\" y=\"218\" /><di:waypoint x=\"870\" y=\"170\" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"Association_0p8zq8n_di\" bpmnElement=\"Association_0p8zq8n\"><di:waypoint x=\"1050\" y=\"218\" /><di:waypoint x=\"1050\" y=\"170\" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"Association_11zpa6h_di\" bpmnElement=\"Association_11zpa6h\"><di:waypoint x=\"1730\" y=\"218\" /><di:waypoint x=\"1730\" y=\"150\" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"Association_1ybki6e_di\" bpmnElement=\"Association_1ybki6e\"><di:waypoint x=\"390\" y=\"240\" /><di:waypoint x=\"390\" y=\"199\" /></bpmndi:BPMNEdge><bpmndi:BPMNEdge id=\"Association_0u1ta5n_di\" bpmnElement=\"Association_0u1ta5n\"><di:waypoint x=\"700\" y=\"298\" /><di:waypoint x=\"700\" y=\"320\" /></bpmndi:BPMNEdge></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn2:definitions>",
					"ElementParameters": "[{\"Id\":\"StartEvent_1\",\"Type\":0,\"Parameters\":{\"manualTriggerDefaultValue-0\":\"1\"},\"SelectedTypeId\":\"ManualTrigger\",\"PromoteResultAs\":null,\"Name\":\"Manual\",\"Description\":null,\"IsDefault\":null,\"ShouldRetry\":null,\"MaxRetryCount\":null,\"ShouldNotLogResult\":null,\"ShouldDispose\":null},{\"Id\":\"Activity_0h4alnp\",\"Type\":1,\"Parameters\":{\"input\":{\"ConnectionString\":{\"mode\":\"csharp\",\"value\":\"#var.ConnectionString\"},\"Query\":{\"mode\":\"sql\",\"value\":\"SELECT patient_id, reason\\r\\nFROM med_appointments\\r\\nWHERE appointment_id = '{{#trigger.data.appointment_id}}'\"},\"Parameters\":[],\"ExecuteType\":{\"mode\":\"select\",\"value\":\"ExecuteReader\"}},\"options\":{\"ThrowErrorOnFailure\":{\"mode\":\"toggle\",\"value\":true},\"CommandTimeoutSeconds\":{\"mode\":\"integer\",\"value\":60},\"SqlTransactionIsolationLevel\":{\"mode\":\"select\",\"value\":\"ReadCommitted\"}},\"cancellationToken\":null},\"SelectedTypeId\":\"/ProcessTask/52de7e2e-788d-4d77-84c9-a6c86a64e2fb/v1\",\"PromoteResultAs\":null,\"Name\":\"Get appointment data\",\"Description\":null,\"IsDefault\":null,\"ShouldRetry\":false,\"MaxRetryCount\":null,\"ShouldNotLogResult\":null,\"ShouldDispose\":null},{\"Id\":\"Activity_0z4c9j6\",\"Type\":1,\"Parameters\":{\"input\":{\"ConnectionString\":{\"mode\":\"csharp\",\"value\":\"#var.ConnectionString\"},\"Query\":{\"mode\":\"sql\",\"value\":\"SELECT \\r\\n    mh.patient_id,\\r\\n    mh.condition,\\r\\n    mh.diagnosis_date,\\r\\n    mh.notes,\\r\\n    CONCAT(mp.first_name, ' ', mp.last_name) AS full_name,\\r\\n    mp.ssn\\r\\nFROM med_history mh\\r\\nJOIN med_patients mp ON mh.patient_id = mp.patient_id\\r\\nWHERE mh.patient_id = '{{#result[Get appointment data].Data[0].patient_id}}'\"},\"Parameters\":[],\"ExecuteType\":{\"mode\":\"select\",\"value\":\"ExecuteReader\"}},\"options\":{\"ThrowErrorOnFailure\":{\"mode\":\"toggle\",\"value\":true},\"CommandTimeoutSeconds\":{\"mode\":\"integer\",\"value\":60},\"SqlTransactionIsolationLevel\":{\"mode\":\"select\",\"value\":\"ReadCommitted\"}},\"cancellationToken\":null},\"SelectedTypeId\":\"/ProcessTask/52de7e2e-788d-4d77-84c9-a6c86a64e2fb/v1\",\"PromoteResultAs\":null,\"Name\":\"Get patient history\",\"Description\":null,\"IsDefault\":null,\"ShouldRetry\":false,\"MaxRetryCount\":null,\"ShouldNotLogResult\":null,\"ShouldDispose\":null},{\"Id\":\"Activity_0z68v6e\",\"Type\":1,\"Parameters\":{\"input\":{\"Model\":{\"mode\":\"text\",\"value\":\"gpt-4o\"},\"ApiKey\":{\"mode\":\"csharp\",\"value\":\"#var.ChatGptApiKey\"},\"Messages\":[{\"Content\":{\"mode\":\"text\",\"value\":\"Patient history is as follows: {{#var.anonymizedData}}\"},\"Role\":{\"mode\":\"text\",\"value\":\"user\"}},{\"Content\":{\"mode\":\"text\",\"value\":\"Reason for the current doctors appointment is {{#result[Get appointment data].Data[0].reason}}\"},\"Role\":{\"mode\":\"text\",\"value\":\"user\"}},{\"Content\":{\"mode\":\"text\",\"value\":\"Labolatory results are as follows: {{#var.lab_results}}\"},\"Role\":{\"mode\":\"text\",\"value\":\"user\"}},{\"Content\":{\"mode\":\"text\",\"value\":\"Using the patient history data, current appontment reason and laboratory results, provide a summary of max 100 words of the current state, up to 5 questions to ask the patient if needed and another 100 words of recommended course of action. Make the output easy to read with bullet points.\"},\"Role\":{\"mode\":\"text\",\"value\":\"user\"}}]},\"options\":{\"MaxTokens\":{\"mode\":\"csharp\",\"value\":\"1000\"},\"N\":{\"mode\":\"integer\",\"value\":1},\"Seed\":{\"mode\":\"csharp\",\"value\":\"\"},\"User\":{\"mode\":\"text\",\"value\":\"\"},\"ThrowExceptionOnErrorResponse\":{\"mode\":\"toggle\",\"value\":true}},\"cancellationToken\":null},\"SelectedTypeId\":\"/ProcessTask/3c32eb4a-4c94-4d4b-b258-f2e66ae7c2e4/v1\",\"PromoteResultAs\":null,\"Name\":\"Summarize with AI\",\"Description\":null,\"IsDefault\":null,\"ShouldRetry\":false,\"MaxRetryCount\":null,\"ShouldNotLogResult\":null,\"ShouldDispose\":null},{\"Id\":\"Activity_1nsommj\",\"Type\":1,\"Parameters\":{\"input\":{\"Model\":{\"mode\":\"text\",\"value\":\"gpt-4o\"},\"ApiKey\":{\"mode\":\"csharp\",\"value\":\"#var.ChatGptApiKey\"},\"Messages\":[{\"Content\":{\"mode\":\"text\",\"value\":\"Patient history is as follows: {{#var.anonymizedData}}\"},\"Role\":{\"mode\":\"text\",\"value\":\"user\"}},{\"Content\":{\"mode\":\"text\",\"value\":\"Reason for the current doctors appointment is {{#result[Get appointment data].Data[0].reason}}\"},\"Role\":{\"mode\":\"text\",\"value\":\"user\"}},{\"Content\":{\"mode\":\"text\",\"value\":\"Based on the appointment reason and medical history provided, do you think laboratory results are needed to prepare a summary of the current state, along with up to 5 questions for the patient, and a recommended course of action? Answer 'Yes' if laboratory results are required; otherwise, answer 'No'. Do not write anything else.\"},\"Role\":{\"mode\":\"text\",\"value\":\"user\"}}]},\"options\":{\"MaxTokens\":{\"mode\":\"csharp\",\"value\":\"1000\"},\"N\":{\"mode\":\"integer\",\"value\":1},\"Seed\":{\"mode\":\"csharp\",\"value\":\"\"},\"User\":{\"mode\":\"text\",\"value\":\"\"},\"ThrowExceptionOnErrorResponse\":{\"mode\":\"toggle\",\"value\":true}},\"cancellationToken\":null},\"SelectedTypeId\":\"/ProcessTask/3c32eb4a-4c94-4d4b-b258-f2e66ae7c2e4/v1\",\"PromoteResultAs\":null,\"Name\":\"Ask AI is lab test needed\",\"Description\":null,\"IsDefault\":null,\"ShouldRetry\":false,\"MaxRetryCount\":null,\"ShouldNotLogResult\":null,\"ShouldDispose\":null},{\"Id\":\"Activity_02k0hfr\",\"Type\":12,\"Parameters\":{\"useStatementMode\":{\"mode\":\"toggle\",\"value\":true},\"variableExpression\":{\"mode\":\"csharp\",\"value\":\"{\\n    string json = #result[Get patient history].Data.ToString();\\n\\n    string anonymizedJson = System.Text.RegularExpressions.Regex.Replace(json, @\\\"\\\\b(?:[A-Z][a-z]+(?: [A-Z][a-z]+){1,2})\\\\b|\\\\b\\\\d{3}[- ]?\\\\d{2}[- ]?\\\\d{4}\\\\b\\\", \\\"\\\");\\n\\n    return JsonConvert.SerializeObject(JArray.Parse(anonymizedJson), Newtonsoft.Json.Formatting.Indented);\\n}\"},\"shouldAssignVariable\":{\"mode\":\"toggle\",\"value\":true},\"variableName\":\"anonymizedData\"},\"SelectedTypeId\":null,\"PromoteResultAs\":null,\"Name\":\"Anonymize data\",\"Description\":null,\"IsDefault\":null,\"ShouldRetry\":null,\"MaxRetryCount\":null,\"ShouldNotLogResult\":null,\"ShouldDispose\":null},{\"Id\":\"Activity_18f8m89\",\"Type\":1,\"Parameters\":{\"input\":{\"ConnectionString\":{\"mode\":\"csharp\",\"value\":\"#var.ConnectionString\"},\"Query\":{\"mode\":\"sql\",\"value\":\"UPDATE \\r\\n    med_appointments\\r\\nSET \\r\\n    ai_summary = '{{#result[Summarize with AI].ChatCompletion.Choices[0].Message.Content}}'\\r\\nWHERE \\r\\n    appointment_id = '{{#trigger.data.appointment_id}}'\"},\"Parameters\":[],\"ExecuteType\":{\"mode\":\"select\",\"value\":\"ExecuteReader\"}},\"options\":{\"ThrowErrorOnFailure\":{\"mode\":\"toggle\",\"value\":true},\"CommandTimeoutSeconds\":{\"mode\":\"integer\",\"value\":60},\"SqlTransactionIsolationLevel\":{\"mode\":\"select\",\"value\":\"ReadCommitted\"}},\"cancellationToken\":null},\"SelectedTypeId\":\"/ProcessTask/52de7e2e-788d-4d77-84c9-a6c86a64e2fb/v1\",\"PromoteResultAs\":null,\"Name\":\"Update appoitment data with AI summary\",\"Description\":null,\"IsDefault\":null,\"ShouldRetry\":false,\"MaxRetryCount\":null,\"ShouldNotLogResult\":null,\"ShouldDispose\":null},{\"Id\":\"Flow_1jpm47u\",\"Type\":4,\"Parameters\":{},\"SelectedTypeId\":null,\"PromoteResultAs\":null,\"Name\":\"yes\",\"Description\":null,\"IsDefault\":false,\"ShouldRetry\":null,\"MaxRetryCount\":null,\"ShouldNotLogResult\":null,\"ShouldDispose\":null},{\"Id\":\"Gateway_1t3wrju\",\"Type\":2,\"Parameters\":{\"expression\":{\"mode\":\"csharp\",\"value\":\"#result[Ask AI is lab test needed].ChatCompletion.Choices[0].Message.Content == \\\"Yes\\\"\"}},\"SelectedTypeId\":null,\"PromoteResultAs\":null,\"Name\":\"Is laboratory results needed?\",\"Description\":null,\"IsDefault\":null,\"ShouldRetry\":null,\"MaxRetryCount\":null,\"ShouldNotLogResult\":null,\"ShouldDispose\":null},{\"Id\":\"Activity_0y5ijz0\",\"Type\":1,\"Parameters\":{\"input\":{\"ConnectionString\":{\"mode\":\"csharp\",\"value\":\"#var.ConnectionString\"},\"Query\":{\"mode\":\"sql\",\"value\":\"SELECT \\r\\n    test_name, \\r\\n    result_value, \\r\\n    test_date\\r\\nFROM med_lab_results\\r\\nWHERE patient_id = '{{#result[Get appointment data].Data[0].patient_id}}'\"},\"Parameters\":[],\"ExecuteType\":{\"mode\":\"select\",\"value\":\"ExecuteReader\"}},\"options\":{\"ThrowErrorOnFailure\":{\"mode\":\"toggle\",\"value\":true},\"CommandTimeoutSeconds\":{\"mode\":\"integer\",\"value\":60},\"SqlTransactionIsolationLevel\":{\"mode\":\"select\",\"value\":\"ReadCommitted\"}},\"cancellationToken\":null},\"SelectedTypeId\":\"/ProcessTask/52de7e2e-788d-4d77-84c9-a6c86a64e2fb/v1\",\"PromoteResultAs\":null,\"Name\":\"Get patient laboratory results\",\"Description\":null,\"IsDefault\":null,\"ShouldRetry\":false,\"MaxRetryCount\":null,\"ShouldNotLogResult\":null,\"ShouldDispose\":null},{\"Id\":\"Activity_1pn18so\",\"Type\":12,\"Parameters\":{\"variableName\":\"lab_results\",\"variableExpression\":{\"mode\":\"text\",\"value\":\"N/A\"},\"shouldAssignVariable\":{\"mode\":\"toggle\",\"value\":true}},\"SelectedTypeId\":null,\"PromoteResultAs\":null,\"Name\":\"Assign lab_results\",\"Description\":null,\"IsDefault\":null,\"ShouldRetry\":null,\"MaxRetryCount\":null,\"ShouldNotLogResult\":null,\"ShouldDispose\":null},{\"Id\":\"Activity_0kcukgt\",\"Type\":12,\"Parameters\":{\"variableName\":\"lab_results\",\"variableExpression\":{\"mode\":\"csharp\",\"value\":\"#result[Get patient laboratory results].Data\"},\"shouldAssignVariable\":{\"mode\":\"toggle\",\"value\":true}},\"SelectedTypeId\":null,\"PromoteResultAs\":null,\"Name\":\"Update lab_results\",\"Description\":null,\"IsDefault\":null,\"ShouldRetry\":null,\"MaxRetryCount\":null,\"ShouldNotLogResult\":null,\"ShouldDispose\":null},{\"Id\":\"Event_0dogmvt\",\"Type\":5,\"Parameters\":{\"expression\":{\"mode\":\"csharp\",\"value\":\"#result[Summarize with AI].ChatCompletion.Choices[0].Message.Content\"}},\"SelectedTypeId\":null,\"PromoteResultAs\":null,\"Name\":null,\"Description\":null,\"IsDefault\":null,\"ShouldRetry\":null,\"MaxRetryCount\":null,\"ShouldNotLogResult\":null,\"ShouldDispose\":null},{\"Id\":\"DataStoreReference_0m8x34o\",\"Type\":23,\"Parameters\":{},\"SelectedTypeId\":null,\"PromoteResultAs\":null,\"Name\":\"Database\",\"Description\":null,\"IsDefault\":null,\"ShouldRetry\":null,\"MaxRetryCount\":null,\"ShouldNotLogResult\":null,\"ShouldDispose\":null},{\"Id\":\"DataStoreReference_16cg3r7\",\"Type\":23,\"Parameters\":{},\"SelectedTypeId\":null,\"PromoteResultAs\":null,\"Name\":\"Database\",\"Description\":null,\"IsDefault\":null,\"ShouldRetry\":null,\"MaxRetryCount\":null,\"ShouldNotLogResult\":null,\"ShouldDispose\":null},{\"Id\":\"DataStoreReference_0yjwqa9\",\"Type\":23,\"Parameters\":{},\"SelectedTypeId\":null,\"PromoteResultAs\":null,\"Name\":\"Database\",\"Description\":null,\"IsDefault\":null,\"ShouldRetry\":null,\"MaxRetryCount\":null,\"ShouldNotLogResult\":null,\"ShouldDispose\":null},{\"Id\":\"DataStoreReference_08whtpi\",\"Type\":23,\"Parameters\":{},\"SelectedTypeId\":null,\"PromoteResultAs\":null,\"Name\":\"Database\",\"Description\":null,\"IsDefault\":null,\"ShouldRetry\":null,\"MaxRetryCount\":null,\"ShouldNotLogResult\":null,\"ShouldDispose\":null},{\"Id\":\"Flow_1k6ogzn\",\"Type\":4,\"Parameters\":{},\"SelectedTypeId\":null,\"PromoteResultAs\":null,\"Name\":\"no\",\"Description\":null,\"IsDefault\":true,\"ShouldRetry\":null,\"MaxRetryCount\":null,\"ShouldNotLogResult\":null,\"ShouldDispose\":null}]",
					"ManualTriggerJson": "[{\"type\":\"System.String\",\"inputType\":\"text\",\"parameterType\":\"TextParameter\",\"defaultValue\":\"\\\"1\\\"\",\"displayOption\":\"\",\"conditionalDisplayProperty\":\"\",\"conditionalDisplayValues\":[],\"isInvalid\":false,\"invalidString\":\"\",\"name\":\"appointment_id\",\"isSecret\":false,\"description\":\"Appointment Id\",\"nonStringifiedDefaultValue\":\"1\"}]",
					"IsSubprocess": false,
					"TriggersJson": "[{\"$type\":\"ManualTrigger\",\"config\":{\"manualTriggerDefaultValue-0\":\"1\"},\"name\":\"Manual\",\"id\":\"StartEvent_1\",\"shouldNotLogParameters\":null}]",
					"AssemblyName": null,
					"PackageId": null,
					"PackageVersion": null,
					"UsedTasksJson": "[\"/ProcessTask/52DE7E2E-788D-4D77-84C9-A6C86A64E2FB/v1\",\"/ProcessTask/3C32EB4A-4C94-4D4B-B258-F2E66AE7C2E4/v1\"]",
					"UsedSubprocessesJson": "{}",
					"ProcessExecutionVersion": "",
					"FrendsVersion": "6.0.2.1280",
					"TargetFramework": "net8.0",
					"StaticRequiredEnvironmentVariables": [],
					"RequiredEnvironmentVariables": [],
					"PromotedResultVariablesJson": "[]",
					"MajorVersion": 0,
					"MinorVersion": 1,
					"IsForMonitoringRule": false,
					"ProcessVariablesJson": null
				},
				"LinkedTasks": {
					"ee0ebe66-565e-4efa-8dc9-c64b4f4f8377": [
						{
							"Id": "52de7e2e-788d-4d77-84c9-a6c86a64e2fb",
							"PackageId": "Frends.MicrosoftSQL.ExecuteQuery",
							"PackageVersion": "1.2.0",
							"Name": "Frends.MicrosoftSQL.ExecuteQuery.MicrosoftSQL.ExecuteQuery(Input, Options, CancellationToken)",
							"FrameworkIdentifier": ".NETCoreApp"
						},
						{
							"Id": "3c32eb4a-4c94-4d4b-b258-f2e66ae7c2e4",
							"PackageId": "Frends.OpenAI.CallChatGPT",
							"PackageVersion": "1.0.1",
							"Name": "Frends.OpenAI.CallChatGPT.OpenAI.CallChatGPT(Input, Options, CancellationToken)",
							"FrameworkIdentifier": ".NETCoreApp"
						}
					]
				},
				"LinkedSubProcess": {},
				"Version": "Acc41"
			}
		}
	]
}